var jData = [{
        "pid": "1169541 ",
        "img_src": "image/13.jpg",
        "title": "金嘉护高级机油 SN 10W40 1L",
        "price": "40.00"
    },
    {
        "pid": "1174195 ",
        "img_src": "image/15.jpg",
        "title": "金嘉护高级机油 SN 15W50 1L",
        "price": "40.00"
    },
    {
        "pid": "1169538 ",
        "img_src": "image/10.jpg",
        "title": "磁护全合成机油 SN/CF  5W40 1L",
        "price": "72.00"
    },
    {
        "pid": "1169534 ",
        "img_src": "image/6.jpg",
        "title": "极护钛流体强化全合成机油 SN.A3/B4  5W40 1L",
        "price": "80.00"
    },
    {
        "pid": "1169536 ",
        "img_src": "image/8.jpg",
        "title": "极护钛流体强化全合成机油 SN.A5/B5  5W30 1L",
        "price": "80.00"
    },
    {
        "pid": "1169532 ",
        "img_src": "image/4.jpg",
        "title": "极护钛流体强化全合成机油 SN.A3/B4  0W40 1L",
        "price": "85.00"
    },
    {
        "pid": "1174193 ",
        "img_src": "image/2.jpg",
        "title": "极护钛流体强化全合成机油 SN 10W60 1L",
        "price": "125.00"
    },
    {
        "pid": "1169545 ",
        "img_src": "image/20.jpg",
        "title": "嘉力高级机油 SL 10W40 4L",
        "price": "90.00"
    },
    {
        "pid": "1174197 ",
        "img_src": "image/21.jpg",
        "title": "嘉力高级机油 SL 15W50 4L",
        "price": "90.00"
    },
    {
        "pid": "1169544 ",
        "img_src": "image/19.jpg",
        "title": "嘉力高级机油 SL 5W30 4L",
        "price": "105.00"
    },
    {
        "pid": "1169543 ",
        "img_src": "image/17.jpg",
        "title": "银嘉护高级机油 SM 10W40 4L",
        "price": "116.00"
    },
    {
        "pid": "1174196 ",
        "img_src": "image/18.jpg",
        "title": "银嘉护高级机油 SM 15W50 4L",
        "price": "116.00"
    },
    {
        "pid": "1169542 ",
        "img_src": "image/16.jpg",
        "title": "银嘉护高级机油 SM 5W30 4L",
        "price": "130.00"
    },
    {
        "pid": "1169540 ",
        "img_src": "image/12.jpg",
        "title": "金嘉护高级机油 SN 10W40 4L",
        "price": "140.00"
    },
    {
        "pid": "1174194 ",
        "img_src": "image/14.jpg",
        "title": "金嘉护高级机油 SN 15W50 4L",
        "price": "140.00"
    },
    {
        "pid": "1169539 ",
        "img_src": "image/11.jpg",
        "title": "金嘉护高级机油 SN 5W30 4L",
        "price": "168.00"
    },
    {
        "pid": "1169537 ",
        "img_src": "image/9.jpg",
        "title": "磁护全合成机油 SN/CF  5W40 4L",
        "price": "268.00"
    },
    {
        "pid": "1169533 ",
        "img_src": "image/5.jpg",
        "title": "极护钛流体强化全合成机油 SN.A3/B4  5W40 4L",
        "price": "320.00"
    },
    {
        "pid": "1169535 ",
        "img_src": "image/7.jpg",
        "title": "极护钛流体强化全合成机油 SN.A5/B5  5W30 4L",
        "price": "320.00"
    },
    {
        "pid": "1169531 ",
        "img_src": "image/3.jpg",
        "title": "极护钛流体强化全合成机油 SN.A3/B4  0W40 4L",
        "price": "340.00"
    },
    {
        "pid": "1174192 ",
        "img_src": "image/1.jpg",
        "title": "极护钛流体强化全合成机油 SN 10W60 4L",
        "price": "460.00"
    }
]


// 2.实例Vue对象
new Vue({
    el: '.g-box',
    data: {
        jiyouData: jData
    },
    methods: {
        // APP端接口
        getApp: function(key, value) {
            var appData = { "key": key, "value": value };
            // alert("key值是:"+key+",vlaue值是:"+value);
            //判断访问终端
            var browser = {
                versions: function() {
                    var u = navigator.userAgent,
                        app = navigator.appVersion;
                    return {
                        trident: u.indexOf('Trident') > -1, //IE内核
                        presto: u.indexOf('Presto') > -1, //opera内核
                        webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
                        gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
                        mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
                        ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
                        android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1, //android终端
                        iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
                        iPad: u.indexOf('iPad') > -1, //是否iPad
                        webApp: u.indexOf('Safari') == -1, //是否web应该程序，没有头部与底部
                        weixin: u.indexOf('MicroMessenger') > -1, //是否微信 （2015-01-22新增）
                        qq: u.match(/\sQQ/i) == " qq" //是否QQ
                    };
                }(),
                language: (navigator.browserLanguage || navigator.language).toLowerCase()
            }

            // 判断是安卓还是苹果
            if (browser.versions.android) {
                getAppData(JSON.stringify(appData));
            } else {
                var iver = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
                iver = parseInt(iver[1], 10);
                // IOS 8以上用webkit方法,IOS 8以下用UIWebview方法
                if (iver >= 8) {
                    // AppModel是OC所注入的对象
                    window.webkit.messageHandlers.AppModel.postMessage({ body: appData });
                } else {
                    getAppData(appData);
                }
            }
        }
    }
})